package gravity;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
public class read
{
	public static class particle implements Serializable
	{
		private static final long serialVersionUID = 3413282129938113146L;
		double[] position = new double[3];
		double[] velocity = new double[3];
		double[] acceleration = new double[3];
		double mass;
		double radius;
		double[] color = new double[3];
	}
	public static particle[] initList(int length, particle[] list)
	{
		for (int index = 0; index < length; index++)
		{
			list[index] = new particle();
		}
		return list;
	}
	public static void main(String[] args) throws Exception
	{
		particle[] lol = new particle[1];
		initList(1, lol);
		lol[0].mass = 12.3;
		System.out.println(lol[0].mass);
		String filename = "test.lol";
		FileOutputStream fos = new FileOutputStream(filename);
		ObjectOutputStream out = new ObjectOutputStream(fos);
		out.writeObject(lol);
		out.close();
		FileInputStream fis = new FileInputStream(filename);
		ObjectInputStream in = new ObjectInputStream(fis);
		particle[] lol2 = (particle[])in.readObject();
		in.close();
		System.out.println(lol2[0].mass);
	}
}